<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <h1>cookie</h1>
    <hr>

    <script>

    document.write('cookie:' + document.cookie + '<br>');

    document.cookie = 'sex = "女"';
    document.write('cookie:' + document.cookie + '<br>');

    document.cookie = 'sex = "女"; path = /';
    document.write('cookie:' + document.cookie + '<br>');
    
    var d = new Date();
    d.setTime(d.getTime() + 3600 * 1000);
    document.cookie = 'username = "静静"; path = /; expires = ' + d.toUTCString();
    document.write('cookie:' + document.cookie + '<br>');

    </script>
</body>
</html>